package com.sugon.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.KnowBaseDao;
import com.sugon.entity.KnowBaseEntity;
import com.sugon.service.KnowBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 知识库Service实现类
 *
 * @author sugon
 * @date 2019-07-10 15:18:30
 */
@Service("knowBaseService")
public class KnowBaseServiceImpl implements KnowBaseService {
    @Autowired
    private KnowBaseDao knowBaseDao;

    @Override
    public KnowBaseEntity queryObject(String id) {
        return knowBaseDao.queryObject(id);
    }

    @Override
    public List<KnowBaseEntity> queryList(Map<String, Object> map) {
        return knowBaseDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return knowBaseDao.queryTotal(map);
    }

    @Override
    public int save(KnowBaseEntity knowBase) {
        knowBase.setId(RandomUtil.randomString(32));
        return knowBaseDao.save(knowBase);
    }

    @Override
    public int update(KnowBaseEntity knowBase) {
        return knowBaseDao.update(knowBase);
    }

    @Override
    public int delete(String id) {
        return knowBaseDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return knowBaseDao.deleteBatch(ids);
    }

    @Override
    public int updateBatch(String[] ids) {
        return knowBaseDao.updateBatch(ids);
    }
}
